<route lang="json5">
{
  style: {
    navigationBarTitleText: '工作日志详情',
  },
}
</route>

<template>
  <view class="common-detail-info-body">
    <view class="detail-info-title">
      <view class="detail-info-title__line"></view>
      <text>{{ formModel.userId_dictText }}</text>
    </view>
    <view class="detail-info-others">
      <view class="others-line"></view>
      <view class="others-item">
        <view class="others-item__label">
          <view class="others-item__label-icon">
            <wd-icon name="a-controlplatform" size="28rpx"></wd-icon>
          </view>
          <view class="others-item__label-text">类型</view>
        </view>
        <view class="others-item__value">{{ formModel?.type_dictText }}</view>
      </view>
      <view class="others-item">
        <view class="others-item__label">
          <view class="others-item__label-icon">
            <wd-icon name="time" size="28rpx"></wd-icon>
          </view>
          <view class="others-item__label-text">填写月份</view>
        </view>
        <view class="others-item__value">{{ formModel?.dateCode }}</view>
      </view>
      <view class="others-item block">
        <view class="others-item__label">
          <view class="others-item__label-icon">
            <wd-icon name="list" size="28rpx"></wd-icon>
          </view>
          <view class="others-item__label-text">本月工作情况</view>
        </view>
        <view class="others-item__value">{{ formModel?.workLog }}</view>
      </view>
      <view class="others-item block">
        <view class="others-item__label">
          <view class="others-item__label-icon">
            <wd-icon name="view-module" size="28rpx"></wd-icon>
          </view>
          <view class="others-item__label-text">下月工作计划</view>
        </view>
        <view class="others-item__value">{{ formModel?.nextWorkLog }}</view>
      </view>
    </view>
  </view>
  <!-- <view class="common-container">
    <wd-form custom-class="common-form" ref="formRef" :model="formModel">
      <wd-cell-group>
        <wd-input
          readonly
          label="用户"
          label-width="110px"
          v-model="formModel.userId_dictText"
          placeholder=""
        />
        <wd-input
          readonly
          label="类型"
          label-width="110px"
          v-model="formModel.type_dictText"
          placeholder=""
        />
        <wd-datetime-picker
          readonly
          type="year-month"
          v-model="formModel.dateCode"
          label="填写月份"
        />
        <wd-cell title="本月工作情况" :label="formModel.workLog"></wd-cell>
        <wd-cell title="下月工作计划" :label="formModel.nextWorkLog"></wd-cell>
      </wd-cell-group>
    </wd-form>
  </view> -->
</template>

<script setup>
import WorkApi from '@/service/work'
import dayjs from 'dayjs'

const initFormModel = {
  dateCode: '',
  type: 'month',
  workLog: '',
  nextWorkLog: '',
}

const formRef = ref()
const formModel = ref({
  dateCode: '',
  type: 'month',
  workLog: '',
  nextWorkLog: '',
})
const formKeyMap = {
  dateCode: '月份',
  workLog: '本月工作情况',
  nextWorkLog: '下月工作计划',
}

const getWorkDetail = async (id) => {
  const params = { id }
  const { code, result } = await WorkApi.getWorkLogDetail(params)
  if (code === 200 && result) {
    const dateCode = dayjs(result.dateCode).valueOf()
    formModel.value = { ...result, dateCode }
  }
}

onLoad((options) => {
  if (options.id) {
    getWorkDetail(options.id)
  }
})
</script>

<script>
export default {
  options: {
    styleIsolation: 'shared',
  },
}
</script>

<style lang="scss">
@import '../../../style/common-form';
</style>
